home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / rexx / pixelizeregion.rexx < prev    next >
OS/2 REXX Batch file  |  1995-04-26  |  2KB  |  57 lines

  1. /* Image Engineer ARexx macro script                  */
  2. /* by Simon Edwards                                   */
  3. /* 27/4/95                                            */
  4. /*                                                    */
  5. /* Pixelizes the region marked out on a given project */
  6.  
  7. Options results
  8. signal on error            /* Setup a place for errors to go */
  9.  
  10. if arg()==0 then exit
  11.  
  12. 'PROJECT_INFO' arg(1) 'BOX'    /* Get the dimensions of the box */
  13. CropBox=RESULT
  14. 'CROP' arg(1) CropBox        /* Crop it */
  15. CropPic=RESULT
  16.  
  17. 'PROJECT_INFO' CropPic 'WIDTH'    /* Get width of cropped image */
  18. CropWidth=RESULT
  19. 'PROJECT_INFO' CropPic 'HEIGHT'    /* Get height of cropped image */
  20. CropHeight=RESULT
  21.  
  22.             /* Scale the croppped image down to lose resolution*/
  23. 'SCALE' CropPic CropWidth/4 CropHeight/4 'FAST'
  24. LittleCrop=RESULT
  25. CLOSE CropPic
  26.  
  27.             /* Npw, scale it up, making the pixels blocky */
  28. 'SCALE' LittleCrop CropWidth CropHeight 'FAST'
  29. PixCrop=RESULT
  30. CLOSE LittleCrop
  31.  
  32. 'MARK' PixCrop 'PRIMARY'    /* Mark the pixelized image as primary */
  33. 'MARK' arg(1) 'SECONDARY'    /* Mark the original as secondary */
  34. 'COMPOSITE' WORD(CropBox,1) WORD(CropBox,2) MIX 100    /* Merge the two */
  35.  
  36. CLOSE PixCrop
  37.  
  38. exit
  39.  
  40. /*******************************************************************/
  41. /* This is where control goes when an error code is returned by IE */
  42. /* It puts up a message saying what happened and on which line     */
  43. /*******************************************************************/
  44. error:
  45. if RC=5 then do            /* Did the user just cancel us? */
  46.     IE_TO_FRONT
  47.     LAST_ERROR
  48.     'REQUEST "'||RESULT||'"'
  49.     exit
  50. end
  51. else do
  52.     IE_TO_FRONT
  53.     LAST_ERROR
  54.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  55.     exit
  56. end
  57.